{% extends 'front/index_base.html' %}

{% block title %}修改资料 - {% endblock %}

{% block head %}
    <link rel="stylesheet" href="{{ url_for('static', filename="front/css/updateprofile.css") }}">
    <script src="{{ url_for('static', filename="front/js/profile.js") }}"></script>
{% endblock %}

{% block body %}
    {% set user = g.front_user %}
    <div class="container-fluid col-sm-8 col-sm-offset-2 form-cont">
        <form class="form-horizontal">
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">头&nbsp&nbsp&nbsp&nbsp像</label>
                <div class="col-sm-10">
                    <img style="width: 120px;height: 120px"
                         src="{{ g.front_user.avatar or url_for('avatar', text=user.username) }}" alt="">

                </div>
            </div>
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label"></label>
                <div class="col-sm-10">
                    <div class="file"><input type="file" name="avatar" id="image">更新头像</div>
                </div>
            </div>

            <div class="form-group">
                <label for="username" class="col-sm-2 control-label">用户名</label>
                <div class="col-sm-10">
                    <input type="text" user_id="{{ user.id }}" class="form-control" id="username"
                           value="{{ user.username }}">
                </div>
            </div>

            <div class="form-group">
                <label for="email" class="col-sm-2 control-label">邮&nbsp&nbsp&nbsp&nbsp箱</label>
                <div class="col-sm-10">
                    <input type="email" class="form-control" id="email" value="{{ user.email or '' }}">
                </div>
            </div>
            <div class="form-group">
                <label for="qq" class="col-sm-2 control-label">企&nbsp&nbsp&nbsp&nbsp鹅</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="qq" placeholder="点击填写" value="{{ user.qq or '' }}">
                </div>
            </div>
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">性&nbsp&nbsp&nbsp&nbsp别</label>
                <div class="col-sm-10">
                    <select class="form-control" id="gender">
                        <option value="男">男</option>
                        <option value="女">女</option>
                        <option value="未知">未知</option>
                    </select>
                    <script>
                        $(function () {
                            var gender = $("#gender option[value='{{ user.gender.value }}']").prop('selected', true);
                        });
                    </script>
                </div>
            </div>

            {% if managed_boards %}
                <div class="form-group">
                    <label for="qq" class="col-sm-2 control-label">管理板块</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" readonly id="managed-boards"
                               value="{{ managed_boards }}">
                    </div>
                </div>
            {% endif %}

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button id="save" style="float: right;" type="submit" class="btn btn-warning">保存修改</button>
                </div>
            </div>
        </form>
    </div>
{% endblock %}